home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / javax / accessibility / AccessibleRole.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  17.3 KB  |  519 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)AccessibleRole.java    1.28 98/08/26
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package javax.accessibility;
  16.  
  17. import java.util.Locale;
  18. import java.util.MissingResourceException;
  19. import java.util.ResourceBundle;
  20.  
  21. /**
  22.  * <P>Class AccessibleRole determines the role of a component.  The role of a 
  23.  * component describes the components generic function, such as
  24.  * "push button," "table," or "list."
  25.  * <p>The toDisplayString method allows you to obtain the localized string 
  26.  * for a locale independent key from a predefined ResourceBundle for the 
  27.  * keys defined in this class.
  28.  * <p>The constants in this class present a strongly typed enumeration
  29.  * of common object roles.  A public constructor for this class has been
  30.  * purposely omitted and applications should use one of the constants
  31.  * from this class.  If the constants in this class are not sufficient
  32.  * to describe the role of an object, a subclass should be generated
  33.  * from this class and it should provide constants in a similar manner.
  34.  *
  35.  * @version     1.18 12/03/97 14:49:26
  36.  * @author      Willie Walker
  37.  * @author    Peter Korn
  38.  */
  39. public class AccessibleRole extends AccessibleBundle {
  40.  
  41. // If you add or remove anything from here, make sure you 
  42. // update AccessibleResourceBundle.java.
  43.  
  44.     /**
  45.      * Object is used to alert the user about something.
  46.      */
  47.     public static final AccessibleRole ALERT               
  48.             = new AccessibleRole("alert");
  49.  
  50.     /**
  51.      * The header for a column of data.
  52.      */
  53.     public static final AccessibleRole COLUMN_HEADER
  54.             = new AccessibleRole("columnheader");
  55.  
  56.     /** 
  57.      * A list of choices the user can select from.  Also optionally 
  58.      * allows the user to enter a choice of their own.
  59.      */     
  60.     public static final AccessibleRole COMBO_BOX
  61.             = new AccessibleRole("combobox");
  62.  
  63.     /** 
  64.      * An iconified internal frame in a DESKTOP_PANE.
  65.      * @see #DESKTOP_PANE
  66.      * @see #INTERNAL_FRAME
  67.      */
  68.     public static final AccessibleRole DESKTOP_ICON
  69.             = new AccessibleRole("desktopicon");
  70.  
  71.     /** 
  72.      * A frame-like object that is clipped by a desktop pane.  The
  73.      * desktop pane, internal frame, and desktop icon objects are 
  74.      * often used to create multiple document interfaces within an
  75.      * application.
  76.      * @see #DESKTOP_ICON
  77.      * @see #DESKTOP_PANE
  78.      * @see #FRAME
  79.      */
  80.     public static final AccessibleRole INTERNAL_FRAME
  81.             = new AccessibleRole("internalframe");
  82.  
  83.     /**
  84.      * A pane that supports internal frames and 
  85.      * iconified versions of those internal frames.
  86.      * @see #DESKTOP_ICON
  87.      * @see #INTERNAL_FRAME
  88.      */
  89.     public static final AccessibleRole DESKTOP_PANE
  90.             = new AccessibleRole("desktoppane");
  91.  
  92.     /** 
  93.      * A specialized pane whose primary use is inside a DIALOG
  94.      * @see #DIALOG
  95.      */
  96.     public static final AccessibleRole OPTION_PANE
  97.             = new AccessibleRole("optionpane");
  98.  
  99.     /** 
  100.      * A top level window with no title or border.
  101.      * @see #FRAME
  102.      * @see #DIALOG
  103.      */
  104.     public static final AccessibleRole WINDOW
  105.             = new AccessibleRole("window");
  106.  
  107.     /**
  108.      * A top level window with a title bar, border, menu bar, etc.  It is
  109.      * often used as the primary window for an application.
  110.      * @see #DIALOG
  111.      * @see #WINDOW
  112.      */
  113.     public static final AccessibleRole FRAME
  114.             = new AccessibleRole("frame");
  115.  
  116.     /** 
  117.      * A top level window with title bar and a border.  A dialog is similar 
  118.      * to a frame, but it has fewer properties and is often used as a 
  119.      * secondary window for an application.
  120.      * @see #FRAME
  121.      * @see #WINDOW
  122.      */
  123.     public static final AccessibleRole DIALOG
  124.             = new AccessibleRole("dialog");
  125.  
  126.     /**
  127.      * A specialized dialog that lets the user choose a color.
  128.      */
  129.     public static final AccessibleRole COLOR_CHOOSER
  130.             = new AccessibleRole("colorchooser");
  131.  
  132.  
  133.     /**
  134.      * A pane that allows the user to navigate through 
  135.      * and select the contents of a directory.  May be used
  136.      * by a file chooser.
  137.      * @see #FILE_CHOOSER
  138.      */
  139.     public static final AccessibleRole DIRECTORY_PANE
  140.             = new AccessibleRole("directorypane");
  141.  
  142.     /**
  143.      * A specialized dialog that displays the files in the directory
  144.      * and lets the user select a file, browse a different directory,
  145.      * or specify a filename.  May use the directory pane to show the
  146.      * contents of a directory.
  147.      * @see #DIRECTORY_PANE
  148.      */
  149.     public static final AccessibleRole FILE_CHOOSER
  150.             = new AccessibleRole("filechooser");
  151.  
  152.     /** 
  153.      * An object that fills up space in a user interface.  It is often
  154.      * used in interfaces to tweak the spacing between components,
  155.      * but serves no other purpose.
  156.      */
  157.     public static final AccessibleRole FILLER
  158.             = new AccessibleRole("filler");
  159.  
  160.     /** 
  161.      * An object used to present an icon or short string in an interface.
  162.      */
  163.     public static final AccessibleRole LABEL
  164.             = new AccessibleRole("label");
  165.  
  166.     /**
  167.      * A specialized pane that has a glass pane and a layered pane as its
  168.      * children.
  169.      * @see #GLASS_PANE
  170.      * @see #LAYERED_PANE
  171.      */
  172.     public static final AccessibleRole ROOT_PANE
  173.             = new AccessibleRole("rootpane");
  174.  
  175.     /**
  176.      * A pane that is guaranteed to be painted on top
  177.      * of all panes beneath it.
  178.      * @see #ROOT_PANE
  179.      */
  180.     public static final AccessibleRole GLASS_PANE
  181.             = new AccessibleRole("glasspane");
  182.  
  183.     /** 
  184.      * A specialized pane that allows its children to be drawn in layers,
  185.      * providing a form of stacking order.  This is usually the pane that
  186.      * holds the menu bar as well as the pane that contains most of the
  187.      * visual components in a window.
  188.      * @see #GLASS_PANE
  189.      * @see #ROOT_PANE
  190.      */
  191.     public static final AccessibleRole LAYERED_PANE
  192.             = new AccessibleRole("layeredpane");
  193.  
  194.     /**
  195.      * An object that presents a list of objects to user and allows the
  196.      * user to select one or more of them.  A list is usually contained
  197.      * within a scroll pane.
  198.      * @see #SCROLL_PANE
  199.      */
  200.     public static final AccessibleRole LIST
  201.             = new AccessibleRole("list");
  202.  
  203.     /**
  204.      * An object usually drawn at the top of the primary dialog box of
  205.      * an application that contains a list of menus the user can choose
  206.      * from.  For example, a menu bar might contain menus for "File,"
  207.      * "Edit," and "Help."
  208.      * @see #MENU
  209.      * @see #POPUP_MENU
  210.      * @see #LAYERED_PANE
  211.      */
  212.     public static final AccessibleRole MENU_BAR
  213.             = new AccessibleRole("menubar");
  214.  
  215.     /** 
  216.      * A temporary window that is usually used to offer the user a 
  217.      * list of choices, and then hides when the user selects one of
  218.      * those choices.
  219.      * @see #MENU
  220.      * @see #MENU_ITEM
  221.      */
  222.     public static final AccessibleRole POPUP_MENU
  223.             = new AccessibleRole("popupmenu");
  224.  
  225.     /** 
  226.      * An object usually contained in a menu bar that contains a list
  227.      * of actions the user can choose from.  A menu can have any object
  228.      * as its children, but most often they are menu items, other menus,
  229.      * or rudimentary objects such as radio buttons, check boxes, or
  230.      * separators.  For example, an application may have an "Edit" menu 
  231.      * that contains menu items for "Cut" and "Paste."
  232.      * @see #MENU_BAR
  233.      * @see #MENU_ITEM
  234.      * @see #SEPARATOR
  235.      * @see #RADIO_BUTTON
  236.      * @see #CHECK_BOX
  237.      * @see #POPUP_MENU
  238.      */    
  239.     public static final AccessibleRole MENU
  240.             = new AccessibleRole("menu");
  241.  
  242.     /**
  243.      * An object usually contained in a menu that presents an action 
  244.      * the user can choose.  For example, the "Cut" menu item in an
  245.      * "Edit" menu would be an action the user can select to cut the
  246.      * selected area of text in a document.
  247.      * @see #MENU_BAR
  248.      * @see #SEPARATOR
  249.      * @see #POPUP_MENU
  250.      */
  251.     public static final AccessibleRole MENU_ITEM
  252.             = new AccessibleRole("menuitem");
  253.  
  254.     /**
  255.      * An object usually contained in a menu to provide a visual
  256.      * and logical separation of the contents in a menu.  For example,
  257.      * the "File" menu of an application might contain menu items for
  258.      * "Open," "Close," and "Exit," and will place a separator between
  259.      * "Close" and "Exit" menu items.
  260.      * @see #MENU
  261.      * @see #MENU_ITEM
  262.      */
  263.     public static final AccessibleRole SEPARATOR
  264.             = new AccessibleRole("separator");
  265.  
  266.     /**
  267.      * An object that presents a series of panels (or page tabs), one at a 
  268.      * time, through some mechanism provided by the object.  The most common 
  269.      * mechanism is a list of tabs at the top of the panel.  The children of
  270.      * a page tab list are all page tabs.
  271.      * @see #PAGE_TAB
  272.      */
  273.     public static final AccessibleRole PAGE_TAB_LIST
  274.             = new AccessibleRole("pagetablist");
  275.  
  276.     /**
  277.      * An object that is a child of a page tab list.  Its sole child is
  278.      * the panel that is to be presented to the user when the user 
  279.      * selects the page tab from the list of tabs in the page tab list.
  280.      * @see #PAGE_TAB_LIST
  281.      */
  282.     public static final AccessibleRole PAGE_TAB
  283.             = new AccessibleRole("pagetab");
  284.  
  285.     /**
  286.      * A generic container that is often used to group objects.
  287.      */
  288.     public static final AccessibleRole PANEL
  289.             = new AccessibleRole("panel");
  290.  
  291.     /**
  292.      * An object used to indicate how much of a task has been completed.
  293.      */
  294.     public static final AccessibleRole PROGRESS_BAR
  295.             = new AccessibleRole("progressbar");
  296.  
  297.     /**
  298.      * A text object used for passwords, or other places where the 
  299.      * text contents is not shown visibly to the user
  300.      */
  301.     public static final AccessibleRole PASSWORD_TEXT
  302.             = new AccessibleRole("passwordtext");
  303.  
  304.     /**
  305.      * An object the user can manipulate to tell the application to do
  306.      * something.
  307.      * @see #CHECK_BOX
  308.      * @see #TOGGLE_BUTTON
  309.      * @see #RADIO_BUTTON
  310.      */
  311.     public static final AccessibleRole PUSH_BUTTON
  312.             = new AccessibleRole("pushbutton");
  313.   
  314.     /**
  315.      * A specialized push button that can be checked or unchecked, but
  316.      * does not provide a separate indicator indicating the current state.
  317.      * @see #PUSH_BUTTON
  318.      * @see #CHECK_BOX
  319.      * @see #RADIO_BUTTON
  320.      */
  321.     public static final AccessibleRole TOGGLE_BUTTON
  322.             = new AccessibleRole("togglebutton");
  323.  
  324.     /**
  325.      * A choice that can be checked or unchecked and provides a 
  326.      * separate indicator indicating the current state.
  327.      * @see #PUSH_BUTTON
  328.      * @see #TOGGLE_BUTTON
  329.      * @see #RADIO_BUTTON
  330.      */
  331.     public static final AccessibleRole CHECK_BOX
  332.             = new AccessibleRole("checkbox");
  333.  
  334.     /**
  335.      * A specialized check box that will cause other radio buttons in the
  336.      * same group to become unchecked when this one is checked.  
  337.      * @see #PUSH_BUTTON
  338.      * @see #TOGGLE_BUTTON
  339.      * @see #CHECK_BOX
  340.      */
  341.     public static final AccessibleRole RADIO_BUTTON
  342.             = new AccessibleRole("radiobutton");
  343.  
  344.     /**
  345.      * The header for a row of data.
  346.      */
  347.     public static final AccessibleRole ROW_HEADER
  348.             = new AccessibleRole("rowheader");
  349.  
  350.     /**
  351.      * An object that allows a user to incrementally view a large amount
  352.      * of information.  Its children can include scroll bars and a viewport.
  353.      * @see #SCROLL_BAR
  354.      * @see #VIEWPORT
  355.      */
  356.     public static final AccessibleRole SCROLL_PANE
  357.             = new AccessibleRole("scrollpane");
  358.  
  359.     /** 
  360.      * An object usually used to allow a user to incrementally view a
  361.      * large amount of data.  Usually used only by a scroll pane.
  362.      * @see #SCROLL_PANE
  363.      */
  364.     public static final AccessibleRole SCROLL_BAR
  365.             = new AccessibleRole("scrollbar");
  366.  
  367.     /**
  368.      * An object usually used in a scroll pane.  It represents the portion 
  369.      * of the entire data that the user can see.  As the user manipulates 
  370.      * the scroll bars, the contents of the viewport can change.
  371.      * @see #SCROLL_PANE
  372.      */
  373.     public static final AccessibleRole VIEWPORT
  374.             = new AccessibleRole("viewport");
  375.  
  376.     /**
  377.      * An object that allows the user to select from a bounded range.  For
  378.      * example, a slider might be used to select a number between 0 and 100.
  379.      */    
  380.     public static final AccessibleRole SLIDER
  381.             = new AccessibleRole("slider");
  382.  
  383.     /**
  384.      * A specialized panel that presents two other panels at the same time.
  385.      * Between the two panels is a divider the user can manipulate to make
  386.      * one panel larger and the other panel smaller.
  387.      */
  388.     public static final AccessibleRole SPLIT_PANE
  389.             = new AccessibleRole("splitpane");
  390.  
  391.     /**
  392.      * An object used to present information in terms of rows and columns.
  393.      * An example might include a spreadsheet application.
  394.      */
  395.     public static final AccessibleRole TABLE
  396.             = new AccessibleRole("table");
  397.  
  398.     /**
  399.      * An object that presents text to the user.  The text is usually
  400.      * editable by the user as opposed to a label.
  401.      * @see #LABEL
  402.      */
  403.     public static final AccessibleRole TEXT
  404.             = new AccessibleRole("text");
  405.  
  406.     /**
  407.      * An object used to present hierarchical information to the user.
  408.      * The individual nodes in the tree can be collapsed and expanded
  409.      * to provide selective disclosure of the tree's contents.
  410.      */
  411.     public static final AccessibleRole TREE
  412.             = new AccessibleRole("tree");
  413.  
  414.     /**
  415.      * A bar or palette usually composed of push buttons or toggle buttons.
  416.      * It is often used to provide the most often used functions for an
  417.      * application.
  418.      */
  419.     public static final AccessibleRole TOOL_BAR
  420.             = new AccessibleRole("toolbar");
  421.  
  422.     /** 
  423.      * An object that provides information about another object.  The 
  424.      * accessibleDescription property of the tool tip is often displayed 
  425.      * to the user in a small "help bubble" when the user causes the 
  426.      * mouse to hover over the object associated with the tool tip.
  427.      */
  428.     public static final AccessibleRole TOOL_TIP
  429.             = new AccessibleRole("tooltip");
  430.  
  431.     /**
  432.      * An AWT component, but nothing else is known about it.
  433.      * @see #SWING_COMPONENT
  434.      * @see #UNKNOWN
  435.      */
  436.     public static final AccessibleRole AWT_COMPONENT
  437.             = new AccessibleRole("awtcomponent");
  438.  
  439.     /**
  440.      * A Swing component, but nothing else is known about it.
  441.      * @see #AWT_COMPONENT
  442.      * @see #UNKNOWN
  443.      */
  444.     public static final AccessibleRole SWING_COMPONENT
  445.             = new AccessibleRole("swingcomponent");
  446.  
  447.     /**
  448.      * The object contains some Accessible information, but its role is
  449.      * not known.
  450.      * @see #AWT_COMPONENT
  451.      * @see #SWING_COMPONENT
  452.      */
  453.     public static final AccessibleRole UNKNOWN
  454.             = new AccessibleRole("unknown");
  455.  
  456. // The following are all under consideration for potential future use.
  457.  
  458. //    public static final AccessibleRole APPLICATION
  459. //            = new AccessibleRole("application");
  460.  
  461. //    public static final AccessibleRole BORDER
  462. //            = new AccessibleRole("border");
  463.  
  464. //    public static final AccessibleRole CHECK_BOX_MENU_ITEM
  465. //            = new AccessibleRole("checkboxmenuitem");
  466.  
  467. //    public static final AccessibleRole CHOICE
  468. //            = new AccessibleRole("choice");
  469.  
  470. //    public static final AccessibleRole COLUMN
  471. //            = new AccessibleRole("column");
  472.  
  473. //    public static final AccessibleRole CURSOR
  474. //            = new AccessibleRole("cursor");
  475.  
  476. //    public static final AccessibleRole DOCUMENT
  477. //            = new AccessibleRole("document");
  478.  
  479. //    public static final AccessibleRole GROUPING
  480. //            = new AccessibleRole("grouping");
  481.  
  482. //    public static final AccessibleRole IMAGE
  483. //            = new AccessibleRole("image");
  484.  
  485. //    public static final AccessibleRole INDICATOR
  486. //            = new AccessibleRole("indicator");
  487.  
  488. //    public static final AccessibleRole LIST_ITEM
  489. //            = new AccessibleRole("listitem");
  490.  
  491. //    public static final AccessibleRole RADIO_BUTTON_MENU_ITEM
  492. //            = new AccessibleRole("radiobuttonmenuitem");
  493.  
  494. //    public static final AccessibleRole ROW
  495. //            = new AccessibleRole("row");
  496.  
  497. //    public static final AccessibleRole TABLE_CELL
  498. //        = new AccessibleRole("tablecell");
  499.  
  500. //    public static final AccessibleRole TREE_NODE
  501. //            = new AccessibleRole("treenode");
  502.  
  503.     /**
  504.      * Create a new AccessibleRole using the given locale independent key.
  505.      * This should not be a public method.  Instead, it is used to create
  506.      * the constants in this file to make it a strongly typed enumeration.
  507.      * Subclasses of this class should enforce similar policy.
  508.      * @param key the locale independent name of the role.
  509.      * @note The String should be a locale independent key for the role.
  510.      * It is not intended to be used as the actual String to display 
  511.      * to the user.  To get the localized string, use toDisplayString.
  512.      * @see AccessibleBundle#toDisplayString
  513.      */
  514.     protected AccessibleRole(String key) {
  515.         this.key = key;        
  516.     }
  517. }
  518.  
  519.